$pp = "";
include("includes/header.php");
$__content__ = "";
$ssHtml = "";
$pname = "";
$replacemeta = false;
$res = mysql_query("select * from sections where id='".(int)($_REQUEST['id'])."'");
while ($row = mysql_fetch_array ($res)) {
$pname = stripslashes($row['name']);
$pdesc = stripslashes($row['description']);
if ($row['position'] == "menu") $replacemeta = true;
/* ============= find tabs and content ============= */
$tabcount = 0;
for ($i=1;$i<=10;$i++) {
if (trim($row['tabtitle'.$i]) != "") $tabcount++;
}
$tabsbtns = "";
$tabscontent = "";
if ($tabcount>1) {
$titleid = "siteTitle";
$tabcounter=1;
for ($i=1;$i<=10;$i++) {
if (trim($row['tabtitle'.$i]) != "") {
$tabsbtns .= "
".$row['tabtitle'.$i]."";
$tabscontent .= "".stripslashes($row['tabcontent'.$i])."
";
$tabcounter++;
}
}
$tabsbtns = "\n";
} else {
$titleid = "siteTitleB";
for ($i=1;$i<=10;$i++) {
if (trim($row['tabcontent'.$i]) != "") {
$tabscontent .= "".stripslashes($row['tabcontent'.$i])."
\n";
}
}
}
/* ============= content layout============= */
if ($row['layout'] == "simple") {
$maincontent = $tabsbtns.$tabscontent;
} else {
$_imgcontent_ = "";
for ($i=1;$i<=10;$i++) {
if ($row['image'.$i] != "" and file_exists("tcache/tsections_".substr($row['image'.$i], 0, -4).".jpg")) $_imgsource_ = "tcache/tsections_".substr($row['image'.$i], 0, -4).".jpg";
else if ($row['image'.$i] != "") $_imgsource_ = "tsections.php?file=".$row['image'.$i]."";
if ($row['image'.$i] != "") $_imgcontent_ .= "";
}
for ($i=1;$i<=5;$i++) {
if ($row['image1'.$i] != "" and file_exists("tcache/tsectionsvideo_".substr($row['image1'.$i], 0, -4).".jpg")) $_imgsource_ = "tcache/tsectionsvideo_".substr($row['image1'.$i], 0, -4).".jpg";
else if ($row['image1'.$i] != "") $_imgsource_ = "tsectionsvideo.php?file=".$row['image1'.$i]."";
if ($row['image1'.$i] != "" and trim($row['video'.$i]) != "") {
preg_match("/width=\"[0-9]*\"/", stripslashes(trim($row['video'.$i])), $matchesw);
preg_match("/height=\"[0-9]*\"/", stripslashes(trim($row['video'.$i])), $matchesh);
preg_match("/src=\"[^\"]+\"/", stripslashes(trim($row['video'.$i])), $matchesv);
if (sizeof($matchesw) and sizeof($matchesh) and sizeof($matchesv)) {
$_w = str_replace(array("width=\"", "\""), array("", ""), $matchesw[0]);
$_h = str_replace(array("height=\"", "\""), array("", ""), $matchesh[0]);
$_v = str_replace(array("src=\"", "\""), array("", ""), $matchesv[0]);
$_imgcontent_ .= "";
}
}
}
if ($_imgcontent_ == "") $maincontent = $tabsbtns.$tabscontent;
else $maincontent = $tabsbtns."".$tabscontent."
\nPhotos - videos
".$_imgcontent_."
\n\n";
}
/* ============= sidebars and final content ============= */
if ($row['father'] != 0) $sidebarLeft = $categories->get_parent_sidebar($row['father'], $row['id']);
else $sidebarLeft = $categories->get_parent_sidebar($row['id'], $row['id']);
$pdflinks = "";
for ($i=1;$i<=5;$i++) {
if ($row['pdf_file'.$i] != "" and file_exists("sectionsimg/".$row['pdf_file'.$i]) and trim($row['pdf_title'.$i])!="") $pdflinks .= " ".$row['pdf_title'.$i]."
\n";
}
$sidebarRight = "";
if ($pdflinks != "") $sidebarRight = "Documentation
\n".$pdflinks."
\n";
$sidebarRight .= str_replace("{SHARE_TITLE}", rawurlencode($pname), $sidebarshare);
$sidebarRightLinks = "";
for ($i=1;$i<=10;$i++) {
if (trim($row['linktitle'.$i]) != "" and trim($row['linkurl'.$i]) != "") {
$sidebarRightLinks .= "".$row['linktitle'.$i]."\n";
}
}
if ($sidebarRightLinks != "") $sidebarRight .= "Related links
\n\n";
$sidebarRight .= $sidebarsearch;
$__content__ = "
".$pname."
".$maincontent."
";
/* ============= slideshow layout ============= */
if ($row['slideshow_type'] == 1 and $row['gallery_id']>0) {
// background slideshow
$x = 1;
$htmlimg = "";
$jsimg = "";
$htmlbull = "";
$res2 = mysql_query("select * from photos where gallery_id='".$row['gallery_id']."' order by id asc");
while ($prow = mysql_fetch_array($res2)) {
$htmlimg .= "\n";
$jsimg .= " {
\"title\" : \"img ".$prow['id']."\",
\"image\" : \"".SITE_URL."galleriesimg/".$prow['image1']."\",
\"firstline\" : \"".str_replace(array("\r\n", "'"), array("\\\r\n", "\'"), stripslashes($prow['name']))."\"
},";
$htmlbull .= "\n";
$x++;
}
$__content__ .= "
";
$ssHtml = "
".$htmlbull."
";
} else if ($row['slideshow_type'] == 2 and $row['gallery_id']>0) {
//ImageFlow
$x = 1;
$htmlimg = "";
$jsimg = "";
$htmlbull = "";
$res2 = mysql_query("select * from photos where gallery_id='".$row['gallery_id']."' order by id asc");
while ($prow = mysql_fetch_array($res2)) {
$htmlimg .= "\n";
//gia home width=\"120\" height=\"80\"
$x++;
}
$ssHtml = "
";
$__content__ .= "
";
} else if ($row['slideshow_type'] == 3) {
// html
$ssHtml = "
".stripslashes($row['htmlcode'])."
";
} else if ($row['slideshow_type'] == 4 and $row['banner_id']>0) {
// banner
$res3 = mysql_query("select * from banners where id='".$row['banner_id']."'");
while ($brow = mysql_fetch_array($res3)) {
if ($brow['linkurl1'] != "") {
$ssHtml = "
";
} else {
$ssHtml = "
";
}
}
} else {
$ssHtml = "";
}
/* ============= - ============= */
}
//""
$ttemplate = $template;
$ttemplate = str_replace("_____SLIDESHOW_____", $ssHtml, $ttemplate);
if ($replacemeta) $ttt = $ttemplate = str_replace("_____SITE_TITLE_____", "_____SITE_TITLE_____\n", $ttemplate);
$ttemplate = str_replace("_____SITE_TITLE_____", $pname.SITE_TITLE, $ttemplate);
$ttemplate = str_replace("_____CONTENT_____", $__content__, $ttemplate);
echo $ttemplate;
?>